import request from '@/utils/request'
const moduleApi = '/goods'

/**
 * 商品信息
 * @param {Object} params
 * @returns
 */
export function getGoodsList(query) {
  return request({
    url: moduleApi + '/goods',
    method: 'get',
    params: query
  })
}

/**
 * 新增商品
 * @param {Object} params
 * @returns
 */
export function addGoods(data) {
  return request({
    url: moduleApi + '/goods',
    headers: { repeatSubmit: false },
    method: 'post',
    data
  })
}

/**
 * 修改商品
 * @param {Object} data
 * @returns
 */
export function updateGoods(data) {
  return request({
    url: moduleApi + '/goods/update',
    headers: { repeatSubmit: false },
    method: 'post',
    data
  })
}

/**
 * 商品详情
 * @param {String} id
 * @returns
 */
export function getGoodsDetail(id) {
  return request({
    url: moduleApi + `/goods/${id}`,
    method: 'get'
  })
}

/**
 * 商品详情图片
 * @param {String} id
 * @returns
 */
export function getGoodsImgDetail(id) {
  return request({
    url: moduleApi + `/goodsDetailImg/${id}`,
    method: 'get'
  })
}

/**
 * 删除图片(商品)
 * @param {String} id
 * @returns
 */
export function delGoodsImgDetail(id) {
  return request({
    url: moduleApi + `/goodsDetailImg/del/${id}`,
    method: 'get'
  })
}

/**
 * 删除图片(套餐)
 * @param {String} id
 * @returns
 */
export function delComboImgDetail(id) {
  return request({
    url: moduleApi + `/comboDetailImg/del/${id}`,
    method: 'get'
  })
}

/**
 * 商品详情-营养信息
 * @param {String} id
 * @returns
 */
export function getGoodsgoodsNutritiveDetail(id) {
  return request({
    url: moduleApi + `/goodsNutritive/${id}`,
    method: 'get'
  })
}

/**
 * 商品 禁/启用
 * @param {String} id
 * @returns
 */
export function disableGoods(id) {
  return request({
    url: moduleApi + `/goods/dis/${id}`,
    method: 'get'
  })
}
